#include "DataStructure/Input/Constraint/RBAR1Data.h"

#include "DataStructure/Common/Validation.h"
#include "DataStructure/Input/Solver/DOFDirections.h"

using namespace SG::DataStructure;

/**
 * @brief 获取从属自由度集合
 *
 * 返回从属自由度集合的实例。
 *
 * @return 从属自由度集合的实例
 */
SG::DataStructure::FEM::DofSet FEM::RBAR1Data::GetSlaveDOFs () const
{
    return Int2VDofSet (m_slaveDOFs);
}

void FEM::RBAR1Data::SetSlaveDOFs (const SG::DataStructure::FEM::DofSet& dofs)
{
    m_slaveDOFs = DofSet2Int (dofs);
}

/// @brief 判断两个RBAR1Data是否相等
/// @param a
/// @param b
/// @return
bool SG::DataStructure::FEM::operator== (const RBAR1Data& a, const RBAR1Data& b)
{
    if (a.m_id != b.m_id)
    {
        return false;
    }
    if (a.m_masterNode != b.m_masterNode)
    {
        return false;
    }
    if (a.m_slaveNodes != b.m_slaveNodes)
    {
        return false;
    }
    if (a.m_slaveDOFs != b.m_slaveDOFs)
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_alpha, b.m_alpha))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_refTemperature, b.m_refTemperature))
    {
        return false;
    }
    if (a.m_domainId != b.m_domainId)
    {
        return false;
    }
    return true;
}